import type { InspectionPlanModel } from './models';

import { requestClient } from '#/api/request';

/**
 * 分页查询点检计划数据集合
 * @param params 分页查询参数
 * @returns 返回查询结果
 */
export async function getInspectionPlanPagedListApi(params?: PageParams) {
  return requestClient.get<PaginationResult<InspectionPlanModel>>(
    '/mes/equipment/inspection/plan/list-page',
    {
      params,
    },
  );
}

/**
 * 创建点检计划
 * @param data 要创建的点检计划
 * @returns 返回结果
 */
export async function createInspectionPlanApi(data: any) {
  return requestClient.post<boolean>('/mes/equipment/inspection/plan', data);
}

/**
 * 更新点检计划
 * @param id 点检计划 Id
 * @param data 要更新的点检计划
 * @returns 返回结果
 */
export async function updateInspectionPlanApi(id: number, data: any) {
  return requestClient.put<boolean>(
    `/mes/equipment/inspection/plan/${id}`,
    data,
  );
}

/**
 * 删除点检计划
 * @param id 点检计划 Id
 * @returns 返回结果
 */
export async function deleteInspectionPlanApi(id: number) {
  return requestClient.delete<boolean>(`/mes/equipment/inspection/plan/${id}`);
}
